import request from "@/utils/request";
import { ArtworkQuery, ArtworkPageResult, ArtworkForm, IndexItemRelativeQuery, IndexItemRelativeForm } from "./model";

/**
 * 艺术品API
 */
class ArtworkAPI {
  /**
   * 获取艺术品分页数据
   *
   * @param queryParams
   */
  static getPage(queryParams?: ArtworkQuery) {
    return request<any, ArtworkPageResult>({
      url:
        "/artwork/getPage?currentPage=" +
        queryParams?.pageNum +
        "&size=" +
        queryParams?.pageSize,
      method: "post",
      data: queryParams,
    });
  }

  /**
   * 新增艺术品
   *
   * @param data
   */
  static add(data: ArtworkForm) {
    return request({
      url: "/artwork/add",
      method: "post",
      data: data,
    });
  }
  /**
   * 修改艺术品
   * @param data 
   * @returns 
   */
  static update(data: ArtworkForm) {
    return request({
      url: "/artwork/edit",
      method: "post",
      data: data,
    });
  }

  /**
   * 删除艺术品
   * @param data 
   * @returns 
   */
  static delete(data: ArtworkForm) {
    return request({
      url: "/artwork/delete",
      method: "post",
      data: data,
    });
  }

  /**
   * 删除模块艺术品
   * @param data 
   * @returns 
   */

  static removeArtworkRelative(data: ArtworkForm) {
    return request({
      url: "/artwork/removeArtworkRelative",
      method: "post",
      data: data,
    });
  }

  /**
   * 获取未关联的艺术品分页数据
   * @param queryParams 
   * @returns 
   */
  static getPageNoRelative(queryParams?: ArtworkQuery) {
    return request<any, ArtworkPageResult>({
      url:
        "/artwork/getPageNoRelative?currentPage=" +
        queryParams?.pageNum +
        "&size=" +
        queryParams?.pageSize,
      method: "post",
      data: queryParams,
    });
  }
  /**
   * 获取已关联的艺术品分页数据
   * @param queryParams 
   * @returns 
   */
  static getPageRelative(queryParams?: ArtworkQuery) {
    return request<any, ArtworkPageResult>({
      url:
        "/artwork/getPageRelative?currentPage=" +
        queryParams?.pageNum +
        "&size=" +
        queryParams?.pageSize,
      method: "post",
      data: queryParams,
    });
  }

  /**
   * 添加到艺术品关联表
   * @param data 
   * @returns 
   */
  static addToRelative(data: ArtworkForm) {
    return request({
      url: "/artwork/addToRelative",
      method: "post",
      data: data,
    });
  }

  /**
 * 获取首页模块未关联艺术品分页数据
 * @param queryParams 
 * @returns 
 */
  static getIndexNoRelativeArtworkPage(queryParams?: IndexItemRelativeQuery) {
    return request<any, ArtworkPageResult>({
      url:
        "/indexItemRelative/getIndexNoRelativeArtworkPage?currentPage=" +
        queryParams?.pageNum +
        "&size=" +
        queryParams?.pageSize,
      method: "post",
      data: queryParams,
    });
  }

  /**
 * 获取首页模块已关联艺术品分页数据
 * @param queryParams 
 * @returns 
 */
  static getIndexRelativeArtworkPage(queryParams?: IndexItemRelativeQuery) {
    return request<any, ArtworkPageResult>({
      url:
        "/indexItemRelative/getIndexRelativeArtworkPage?currentPage=" +
        queryParams?.pageNum +
        "&size=" +
        queryParams?.pageSize,
      method: "post",
      data: queryParams,
    });
  }


  // getIndexRelativeArtworkPage


  /**
   * 添加到艺术品关联表
   * @param data 
   * @returns 
   */
  static addToIndexRelative(data: ArtworkForm) {
    return request({
      url: "/indexItemRelative/add",
      method: "post",
      data: data,
    });
  }

  /**
   * 保存首页显示排序
   * @param data 
   * @returns 
   */
  static saveSort(data: any[]) {
    return request({
      url: "/indexItemRelative/saveSort",
      method: "post",
      data: data,
    });
  }

  /**
   * 删除关系
   * @param data 
   * @returns 
   */
  static deleteIndexItemRelative(data: ArtworkForm) {
    return request({
      url: "/indexItemRelative/delete",
      method: "post",
      data: data,
    });
  }

  /**
   * 未关联的作品在线分页
   * @param data 
   * @returns 
   */
  static getPageNoRelativeOnline(queryParams?: ArtworkQuery) {
    return request<any, ArtworkPageResult>({
      url:
        "/artwork/getPageNoRelativeOnline?currentPage=" +
        queryParams?.pageNum +
        "&size=" +
        queryParams?.pageSize,
      method: "post",
      data: queryParams,
    });
  }
  /**
   * 已关联的作品在线分页
   * @param data 
   * @returns 
   */
  static getPageRelativeOnline(queryParams?: ArtworkQuery) {
    return request<any, ArtworkPageResult>({
      url:
        "/artwork/getPageRelativeOnline?currentPage=" +
        queryParams?.pageNum +
        "&size=" +
        queryParams?.pageSize,
      method: "post",
      data: queryParams,
    });
  }

  // getPageRelativeOnline




}

export default ArtworkAPI;
